<!DOCTYPE html>
<html lang="utf-8">
<style>
pre {
    background: #EEE;
    border: 1px solid #CCC;
    padding: 10px;
}
#page-wrapper {
    border-top: 5px solid #69c773;
    margin: 1em auto;
    width: 950px;
}
</style>


<div id="page-wrapper">
    <pre id="messages">Enter message & Submit to https-server</pre>
    <textarea id="txtCon" >content</textarea>
    <style type="text/css">
		#txtCon{width:100px; height:20px;}
	</style>
    <button id="submit" onclick="snd2svr('/')">Submit</button>
</div>

<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="js/ws.js"></script>

<script type="text/javascript">
function snd2svr(url){
    var txt = document.getElementById("txtCon").value;
    // JQuery json数据打包
    var json={txt:txt, var1: "v1", var2: "v2"};
    // JQuery get-method 提交
 	$.get(url, JSON.stringify(json), "json");
}
</script> 